//
//  StandbyContentViewModel.swift
//  TimMusic
//
//  Created by nkl on 2024/10/25.
//

import Foundation
import KLSwiftyKit

class StandbyContentViewModel: ObservableObject {
    @Published var dataList: [WidgetsModel] = []

    func requestData() {
        guard let dataPath = Bundle.main.path(forResource: "StandBys.plist", ofType: nil),
              let data = try? Data(contentsOf: URL(fileURLWithPath: dataPath)) else {
            dataList = []
            return
        }
        do {
            let decoder = PropertyListDecoder()
            let datas = try decoder.decode([WidgetsModel].self, from: data)
            dataList = datas
        } catch {
            print("Error decoding plist: \(error)")
            dataList = []
        }
    }
}
